'use strict';

/**
 * @param {Egg.Application} app - egg application
 */
module.exports = app => {
  // app.beforeStart(async () => {
  //   await app.model.sync({ alter: true });//force  false 为不覆盖 true会删除再创建; alter true可以 添加或删除字段;
  // });
  const { router, controller, io } = app;
  router.get('/', controller.home.index);
  // 获取账号信息
  router.get('/formTemplateList', controller.formTemplate.formTemplate);
  router.post('/modifyForm', controller.formTemplate.modifyForm);
  router.get('/editorFormTemplate', controller.formTemplate.editorFormTemplate);
  router.post('/saveFormTemplate', controller.formTemplate.saveFormTemplate);
  router.post('/deleteFormTemplate', controller.formTemplate.deleteFormTemplate);
  router.get('/getDataPort', controller.formDataSource.getDataPort);
  router.get('/getParamReturn', controller.formDataSource.getParamReturn);
  router.get('/getDataSource', controller.formDataSource.getDataSource);



  // app.io.route('deploy', app.io.controller.deploy.res);
  app.io.of('/').route('deploy', app.io.controller.deploy.res);
};
